package com.boot.security.server.dao;

import java.util.List;
import java.util.Map;

import com.boot.security.server.model.AppFamMembe;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.AppTradePayno;

@Mapper
public interface AppTradePaynoDao {

    @Select("select * from app_trade_payno t where t.id = #{id}")
    AppTradePayno getById(Long id);

    @Select("select * from app_trade_payno t where t.outtradeno = #{tradeno}")
    AppTradePayno getByOuttradeno(String tradeno);
    @Delete("delete from app_trade_payno where id = #{id}")
    int delete(Long id);

    int update(AppTradePayno appTradePayno);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into app_trade_payno(fid, tradepaynoid, outtradeno, authcode, totalamount, subject, hostcode, refundno, notifyid, notifytime, buyeremail, selleremail, gmtcreate, batchno, gmtrefund, refundstatus, applypeople, applyphone, applysocial, patientname, patientsex, patientsocial, patientphone, orderstatus, feestatus, orderno, tradeno, orderdate, patientid, times, paytype, chequtype) values(#{fid}, #{tradepaynoid}, #{outtradeno}, #{authcode}, #{totalamount}, #{subject}, #{hostcode}, #{refundno}, #{notifyid}, #{notifytime}, #{buyeremail}, #{selleremail}, #{gmtcreate}, #{batchno}, #{gmtrefund}, #{refundstatus}, #{applypeople}, #{applyphone}, #{applysocial}, #{patientname}, #{patientsex}, #{patientsocial}, #{patientphone}, #{orderstatus}, #{feestatus}, #{orderno}, #{tradeno}, #{orderdate}, #{patientid}, #{times}, #{paytype}, #{chequtype})")
    int save(AppTradePayno appTradePayno);
    
    int count(@Param("params") Map<String, Object> params);

    List<AppTradePayno> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
   //
//    @Select("select * from app_trade_payno t where t.openId = #{openId} or  t.cardno = #{cardno} or  t.idCard = #{idCard} or  t.cardtype = #{cardtype}  or  t.phoneNo = #{phoneNo}  ")
//    List<AppFamMembe> getfamlist(@Param("openId") String openId, @Param("cardno") String cardno, @Param("idCard") String idCard, @Param("cardtype") String cardtype, @Param("phoneNo") String phoneNo);

}
